<?php
  namespace common\models;

  use yii\behaviors\TimestampBehavior;

class BaseModel extends \yii\db\ActiveRecord
{
  public $a = 't';

  public function behaviors()
  {
    return [
      TimestampBehavior::className(),
    ];
  }

  public static function find($f = -1)
  {
    $aq = new AQ(get_called_class());
    if($f === 0) {
      return $aq->active();
    }else if($f === 1) {
      return $aq->deleted();
    }else{
     return $aq;
    }
  }
  public static function findActive()
  {
    return (new AQ(get_called_class()))->active();
  }

  public function deleted($flag){
    $this->deleted = $flag;
    $this->save();
  }

}